//将方法变成属性
// const mapDispatchToProps ={
//     onIncreaseClick: ()=>{
//         return {
//             type: "INCREASE"
//         }
//     }
// }
export const increase =()=>{
    return {
        type:"INCREASE"
    }
}
export const decrease =()=>{
    return {
        type:"DECREASE"
    }
}

export const getdatas = (data)=>{
    return {
        type:"GETDATAS",
        data:data
    }
}

export function fetchList(){
    return dispatch=>{
        return(
            fetch('https://api.douban.com/v2/movie/top250')
            .then(function(response) {
                return response.json()
            }).then(function(data) {
                dispatch(getdatas(data))
            }).catch(function(e) {
                console.log("Oops, error")
            })
        )
    }
}